﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Wijmo.Master" AutoEventWireup="true" CodeBehind="Sorting.aspx.cs" Inherits="ControlExplorer.C1GridView.Sorting" %>

<%@ Register Assembly="C1.Web.Wijmo.Controls.3" Namespace="C1.Web.Wijmo.Controls.C1GridView" TagPrefix="wijmo" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
	<wijmo:C1GridView ID="C1GridView1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="false" AllowSorting="true">
		<CallbackSettings Action="Sorting" />
		<Columns>
			<wijmo:C1BoundField DataField="ProductName" SortExpression="ProductName" HeaderText="产品名" />
			<wijmo:C1BoundField DataField="OrderID" SortExpression="OrderID" HeaderText="订单ID" />
			<wijmo:C1BoundField DataField="Quantity" SortExpression="Quantity" HeaderText="数量" />
			<wijmo:C1BoundField DataField="Total" SortExpression="Total" SortDirection="Descending" HeaderText="总计" />
		</Columns>
	</wijmo:C1GridView>

	<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\C1NWind.mdb;Persist Security Info=True"
		ProviderName="System.Data.OleDb" SelectCommand="SELECT TOP 15 Products.ProductName, d.OrderID, d.Quantity, (d.UnitPrice * d.Quantity) as Total FROM Products INNER JOIN (SELECT details.ProductID, details.OrderID, details.UnitPrice, details.Quantity FROM [Order Details] AS details INNER JOIN (SELECT OrderID FROM Orders WHERE Year(OrderDate) = 1994) AS tmp ON details.OrderID = tmp.OrderID) as d ON Products.ProductID = d.ProductID ORDER BY d.ProductID">
	</asp:SqlDataSource>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ControlOptions" runat="server">
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="Description" runat="server">
	<p>
		<strong>C1GridView</strong>支持排序。
	</p>

	<p>
		如果<strong> AllowSorting</strong>属性设置为True则排序是允许
		列属性<strong>SortExpression</strong>设定非空值则允许最终用户排序
	</p>

	<p>在此示例使用下列属性：</p>
	<ul>
		<li><strong>AllowSorting</strong> - 启用排序。</li>
	</ul>

	<p>此示例中使用以下的列属性：</p>
	<ul>
		<li><strong>SortExpression</strong> -用控件指定的排序表达式来排序数据。</li>
		<li><strong>SortDirection</strong> - <strong>总计</strong>栏中自动降序排序。</li>
	</ul>

	<p>单击列标题按该列排序。</p>
</asp:Content>
